﻿@{
    ViewBag.Title = "添加楼层信息";
    Layout = "~/Views/Shared/_Layout.cshtml";
    <script charset="utf-8" src="/resources/scripts/ajaxfileupload.js"></script>
}

@using AFT.Parking.Entity;
@model MallArea
<div class="content-box">
    <!-- Start Content Box -->
    <div class="content-box-header">
        <h3>添加楼层信息</h3>
        <div class="clear"></div>
    </div>
    <!-- End .content-box-header -->
    <div class="content-box-content">

        <div class="tab-content default-tab" id="tab2">
            <form method="post" id="frm">
                <fieldset>
                    <!-- Set class to "column-left" or "column-right" on fieldsets to divide the form into columns -->
                    @Html.Hidden("ParkingId", Model.ParkingId)
                    <p>
                        <label>停车场名称</label>
                        @ViewBag.ParkingName
                    </p>
                    <p>
                        <label>启用</label>
                        @Html.CheckBox("IsEnable", Model.IsEnable)
                    </p>
                    <p>
                        <label>楼层名称</label>
                        @Html.TextBox("Name", Model.Name, new { @class = "text-input small-input" })
                    </p>
                    <p>
                        <label>比例</label>
                        @Html.TextBox("Scale", Model.Scale, new { @class = "text-input small-input" })
                        <br />
                        <small>单位：米，输入小数或者整数，表示1像素与该数值的比例(px:m)。</small>
                    </p>
                    <p>
                        <label>楼层图片</label>
                        <a href="javascript:void(0)" id="aFile">上传图片</a><br />
                        <img id="ImgShow" src="@Model.ImgUrl" width="200px" height="150px" />
                        @Html.Hidden("ImgUrl", Model.ImgUrl)
                    </p>
                    <p>
                        <input class="button" type="submit" id="btnSubmit" value=" 保 存 " />
                        <input class="button" type="button" id="btnBack" value=" 返 回 " /> <br />
                        <span class="input-notification @ViewBag.Icon png_bg">@ViewBag.Message</span>
                        <input type="hidden" id="hd_backUrl" value="/parkingAreas/areas?parkingId=@Model.ParkingId">
                    </p>
                </fieldset>
                <div class="clear"></div>
                <!-- End .clear -->

                <script type="text/javascript">
                    new AjaxUpload($("#aFile"), {
                        action: '/MallAreas/FileUpLoadFile',
                        data: {
                            folderName: "Areas"
                        },
                        name: 'UploadImg',
                        responseType: "json",
                        onSubmit: function (file, extension) {
                        },
                        onComplete: function (file, data) {
                            console.log(data);
                            if (data.Value) {
                                $("#ImgShow").attr("src", data.Result[0]);
                                $("#ImgUrl").val(data.Result[0]);
                            }
                            else {
                                alert("上传失败。");
                            }
                        }
                    });

                </script>
            </form>
        </div>
        <!-- End #tab2 -->
    </div>
    <!-- End .content-box-content -->
</div>